<%@page import="systems.AdsSystem"%>
<%@page import="helpers.UrlHelper"%>
<%@page import="entities.KeywordRanking"%>
<% 
String name  = (String) request.getAttribute("name");
KeywordRanking keyword = (KeywordRanking) request.getAttribute("keyword");
String error = (String) request.getAttribute("error");

//Set content for Seo
String title = "Check Keyword Ranking - a " + UrlHelper.getDomainServer(request) + " tool FREE";
String description = UrlHelper.getDomainServer(request) + " get keywork ranking of site, check full information keyword ranking of site in checksiteinfo.net";
String keywords = "check keyword, keyword, keyword ranking, keyword ranking report, google seo keyword rankings, find top keywords";
String url = UrlHelper.getServerUrl(request) + "/kranking";

if (keyword != null) {
	title = "Keyword Ranking  " + keyword.getDomain() + " information in " + UrlHelper.getDomainServer(request);
	description = "Ranking Keyword for domain " + keyword.getDomain() + ". Tool show where your site ranks for a keyword but won't help you rank higher"; 
	keywords = keyword.getDomain() + ", " + keywords;
	url = url + "?q=" + keyword.getDomain();
}
%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<jsp:include page="/layouts/header.jsp">
	<jsp:param name="title" value="<%=title %>" />
    <jsp:param name="description" value="<%=description %>" />
    <jsp:param name="keywords" value="<%=keywords %>" />
    <jsp:param name="ogtitle" value="<%=title %>" />
    <jsp:param name="ogurl" value="<%=url %>" />
    <jsp:param name="ogdescription" value="<%=description%>" />
</jsp:include>

		<div class="row-fluid">
		
			<div class="span8">
				<div class="row-fluid">
					<section>
						<div class="block2">
							<div class="title-block">
								<h3>Check Keyword Ranking</h3>
								<div class="divider-arrow"></div>
							</div>
							<div class="content-block">
								<form action="/kranking" class="input-append" id="search">
									<input type="text" role="textbox" class="xlarge ui-autocomplete-input" id="artist_search" name="q" placeholder="ex: google.com" value="">
									<input class="btn search-bt" type="submit" value="">
								</form>
							</div>
							
							<hr />
							
							<% if (keyword != null) { %>
							<section class="ip-result">
								<% if (keyword.getPositionContent().isEmpty()) { %>
								<div class="row-fluid f-info">
									<div class="span12">
										Sorry, we currently do not collect enough data for <%=keyword.getDomain() %>.
										<br />
										<div class="adv">
											<%=AdsSystem.getAds468x60() %>
										</div>
									</div>
								</div>
								<% } else { %>
								<script type="text/javascript" src="http://www.google.com/jsapi"></script>
								<script type="text/javascript">
								<%=keyword.getChartJs() %>
								</script>
								
								<div class="row-fluid f-info">
									<div class="span12">
										<h4><%=keyword.getDomain() %> Ranking Position Analysis</h4>
										<div class="adv">
											<%=AdsSystem.getAds468x15() %>
											<br />
										</div>
										<ul>
											<li>
												<div id="chart_div_pie"></div>
											</li>
											<li>
												<br />
												<%=keyword.getPositionContent() %>
											</li>
										</ul>
										
										<div class="adv" align="center">
											<%=AdsSystem.getAds468x60() %>
											<br /><br />
										</div>
										
										<h4><%=keyword.getDomain() %> keywords by time</h4>
										<div class="adv">
											<%=AdsSystem.getAds468x15() %>
											<br />
										</div>
										<ul>
											<li>
												<div id="chart_div_line"></div>
											</li>
										</ul>
										
										<h4>Best of 1 positions for <%=keyword.getDomain() %></h4>
										<ul>
											<li>
												<%=keyword.getBest1position() %>
											</li>
										</ul>
										
										<h4>Best of 2-5 positions for <%=keyword.getDomain() %></h4>
										<ul>
											<li>
												<%=keyword.getBest2positions() %>
											</li>
										</ul>
										
										<h4>Best of 6-10 positions for <%=keyword.getDomain() %></h4>
										<ul>
											<li>
												<%=keyword.getBest10positions() %>
											</li>
										</ul>
									</div>
								</div>
								<% } %>
							</section>
							<% } %>
							
						</div>
						
					</section>
					
				</div>
			</div>
			
			<jsp:include page="/elements/right.jsp" />
		</div>
	
<jsp:include page="/layouts/footer.jsp" />